import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:hockey/extensions/jzx_json_extension.dart';

part 'jzx_user_data.freezed.dart';
part 'jzx_user_data.g.dart';

@freezed
class JzxUserData with _$JzxUserData {
  const factory JzxUserData({
    @JzxJsonAlwaysNum() @Default(0) num age,
    @JzxJsonAlwaysNum() @Default(0) num auditStatus,
    @JzxJsonAlwaysNum() @Default(0) num availableCoins,
    @JzxJsonAlwaysString() @Default('') String avatar,
    @JzxJsonAlwaysString() @Default('') String avatarMiddleThumbUrl,
    @JzxJsonAlwaysNum() @Default(0) num avatarStatus,
    @JzxJsonAlwaysString() @Default('') String avatarThumbUrl,
    @JzxJsonAlwaysString() @Default('') String avatarUrl,
    @JzxJsonAlwaysString() @Default('') String birthday,
    String? country,
    @JzxJsonAlwaysString() @Default('') String createTime,
    @JzxJsonAlwaysNum() @Default(0) num followNum,
    @JzxJsonAlwaysNum() @Default(0) num followingNum,
    @JzxJsonAlwaysNum() @Default(0) num gender,
    @JzxJsonAlwaysNum() @Default(0) num giftWallAction,
    @Default(false) bool hasEquity,
    @JzxJsonAlwaysNum() @Default(0) num hasIllegalAvatar,
    @Default(false) bool isAnswer,
    @Default(false) bool isBlock,
    @Default(false) bool isHavePassword,
    @Default(false) bool isInternal,
    @Default(false) bool isMultiple,
    @Default(false) bool isRecharge,
    @Default(false) bool isReview,
    @Default(false) bool isSwitchNotDisturbCall,
    @Default(false) bool isSwitchNotDisturbIm,
    @Default(false) bool isVip,
    @JzxJsonAlwaysNum() @Default(0) num level,
    String? loginPkgName,
    @JzxJsonAlwaysString() @Default('') String nickname,
    @JzxJsonAlwaysNum() @Default(0) num praiseNum,
    @JzxJsonAlwaysString() @Default('') String registerCountry,
    String? registerPkgName,
    @JzxJsonAlwaysString() @Default('') String rongcloudToken,
    @Default([]) List<TagDetails> tagDetails,
    @Default([]) List<String> tagsList,
    @JzxJsonAlwaysString() @Default('') String userId,
    @JzxJsonAlwaysNum() @Default(0) num userType,
  }) = _JzxUserData;

  factory JzxUserData.fromJson(Map<String, Object?> json) =>
      _$JzxUserDataFromJson(json);
}

@freezed
class TagDetails with _$TagDetails {
  const factory TagDetails({
    String? tag,
    String? tagColor,
    String? tagTip,
  }) = _TagDetails;

  factory TagDetails.fromJson(Map<String, Object?> json) =>
      _$TagDetailsFromJson(json);
}
